#ifndef WEBWINDOW_H
#define WEBWINDOW_H

#include "webhost.h"
#include "window.h"
#include "qwebview.h"
#include "qmainwindow.h"

class WebWindow: public WebHost {

	Q_OBJECT

	/*
	Q_PROPERTY(QString title READ getTitle WRITE setTitle)
	Q_PROPERTY(bool visible READ getVisible WRITE setVisible)
	Q_PROPERTY(double opacity READ getOpacity WRITE setOpacity)
	Q_PROPERTY(bool modified READ getModified WRITE setModified)
	Q_PROPERTY(QString filePath READ getFilePath WRITE setFilePath)
	*/

private:

	QWebView* webView;
	Window* window;
	QString filePath;
	void updateFilePath();
	bool eventFilter(QObject *o, QEvent *e);

public:

	explicit WebWindow(QObject *parent = 0);
	virtual ~WebWindow();

private slots:

	void javaScriptWindowObjectCleared();
	bool onCloseQuery(QCloseEvent* event);

public slots:

	QString getTitle();
	void setTitle(QString title);
	bool getVisible();
	void setVisible(bool visible);
	double getOpacity();
	void setOpacity(double opacity);
	bool getModified();
	void setModified(bool modified);
	QString getFilePath();
	void setFilePath(QString filePath = "");
	void setGeometry(int x, int y, int w, int h);
	void setWindowState(int windowState);
	void setWindowMinWidth(int minWidth);
	void setWindowMinHeight(int minHeight);

	void grabMouse();

};

#endif // WEBWINDOW_H
